package ws.performancetest.tests.synchronization.lock;

/**
 * This interface provides services to add, remove, get or alter data
 * on some shared memory.
 *
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public interface SharedList {

  /**
   * Add an element to the shared memory.
   */
  void add() throws InterruptedException;
  /**
   * Read an element from the shared memory.
   * This operation doesn't change the state of the shared memory.
   */
  void read() throws InterruptedException;
  /**
   * Remove an element from the shared memory.
   */
  void remove() throws InterruptedException;
  /**
   * Change the value of an element from the shared memory.
   */
  void write() throws InterruptedException;

  /**
   * Lock the access to the shared memory.
   *
   * While a threads owns the lock of the shared memory, only this thread
   * can operate upon the memory, the others have to wait for the unlock
   * operation.
   */
  void lock();
  /**
   * Unlock the access to the shared memory.
   */
  void unlock();
}
